Share via


AppDomain.Unload Method [IIS 7 and higher]

Unloads an ASP.NET application domain from a Web server.

Syntax

oAppDomain.Unload
oAppDomain.Unload();

Parameters

This method takes no parameters.

Return Value

This method does not return a value.

Remarks

The IIS 6.0 AppUnload command unloaded out-of-process ASP applications. The IIS 7 AppDomain.Unload method unloads ASP.NET application domains. This method applies only to managed code. IIS 7 has no method that corresponds to AppUnload because the IIS 5.0 compatibility mode that AppUnload supported is now deprecated.

Example

The following example demonstrates how to unload an application domain. The first section of the example unloads all application domains on a Web server. The second section unloads only the application domain named "Northwind".

' ---- Unload all application domains. ----
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get all of the application domains on the Web server.
Set oAppDomains = oWebAdmin.ExecQuery("SELECT * FROM AppDomain")

' Unload all of the application domains.

For Each oAppDomain In oAppDomains
    oAppDomain.Unload
Next

' ---- Unload only the Northwind application domain. ----
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get all of the application domains on the Web server.
Set oAppDomains = oWebAdmin.ExecQuery("SELECT * FROM AppDomain")

' Unload the Northwind application domain.
For Each oAppDomain In oAppDomains
    If oAppDomain.ApplicationPath = "/Northwind/" Then
        oAppDomain.Unload
    End If
Next

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

AppDomain Class [IIS 7 and higher]